/*
 *  $Id: ParticleRate.cs 1041 2010-05-15 20:19:43Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008-2009 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

using System;
using System.Collections.Generic;

using AgateLib.DisplayLib;

namespace Ragima.UI {
    /// <summary>
    /// Стандартные генераторы темпов появления частиц.
    /// </summary>
    public static class ParticleRate {
        /// <summary>
        /// Постоянный темп.
        /// </summary>
        public static IEnumerable<double> Always(double countPerSecond) {
            while (true)
                yield return countPerSecond / Display.FramesPerSecond;
        }

        /// <summary>
        /// Случайный темп в определенных рамках.
        /// </summary>
        public static IEnumerable<double> Random(double min, double max) {
            double range = max - min;
            while (true)
                yield return (min + range * Randomizer.Global.NextDouble()) / Display.FramesPerSecond;
        }
    }
}
